
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.8.3.js" type="text/javascript"></script>
</head>
<style>

</style>
<body>
<table>
    <tr>
        <th>编号</th>

        <th>标题</th>
    </tr>
<table id="page"></table>
    <tr>
        <td colspan="2" >
            <pre>第<span id="index"></span>页/共<span id="count"></span>页</pre>
            <a href="#" id="shou">首页</a>
            <a href="#" id="up">上一页</a>
            <a href="#" id="down">下一页</a>
            <a href="#" id="wei">尾页</a>
        </td>
    </tr>
</table>
</body>

<script>


    function lifeiwu(pageIndex) {
        $.ajax({
            url: "RtwoBordServlet",
            type: "POST",
            data:{
                pageIndex:pageIndex
            },
            dataType:"json",
            success:function (rel) {
                var $page= $("#page");
                var board="";
                dex=rel.dex;
                tto=rel.tto;
                $.each(rel.list,function (i,n) {
                     board+="<tr>";
                     board+="<td>"+n.bId+"</td>";
                     board+="<td>"+n.bTitle+"</td>";
                     board+="</tr>";
                })
                $page.html(board);
                $("#index").html(dex);
                $("#count").html(tto);
            },error: function (jqXHR, textStatus, errorThrown) {
                /*弹出jqXHR对象的信息*/
                alert(jqXHR.status);
                alert(jqXHR.readyState);
                alert(jqXHR.statusText);
                /*弹出其他两个参数的信息*/
                alert(textStatus);
                alert(errorThrown);
            }


        })

    }

    $(function () {

        lifeiwu(0);

        $("#shou").click(function () {
            dex=1;
            lifeiwu(dex);
        });
        $("#up").click(function () {
            lifeiwu(dex-1);
        });
        $("#down").click(function () {
            lifeiwu(dex+1);
        });
        $("#wei").click(function () {
            lifeiwu(tto);
        });

    })
</script>
</html>
